import java.util.Random;

import java.util.Scanner;

import javax.swing.JOptionPane;

public class Challenge6
{
	public static void main(String[] args)
	{
		String userSelection = "";
		Random randomNumberGenerator = new Random();
		int randomNumber = 0;
		int randomNumber2 = 0;
		int randomNumber3 = 0;
		int randomNumber4 = 0;
		
		int heroHP = 100;
		int citizenHP = 20;
		int bossHP = 100;
		
		int heroDMG = randomNumber;
		int heroHEAL = randomNumber2;
		int bossDMG = randomNumber3;
		int citizenDMG = randomNumber4;
		
		String heroName = JOptionPane.showInputDialog(null, "Welcome, what is your name?");
		JOptionPane.showMessageDialog(null, "Welcome " + heroName + "!");
		JOptionPane.showMessageDialog(null, "A citizen punched you in the face looking for a fight");		
		
		while (citizenHP > 0)
		{
			String HAR = JOptionPane.showInputDialog(null, "Press (a) for attack or (h) for heal!");
			switch(HAR)
			{
				
				case "a":
				case "A":
					randomNumber = randomNumberGenerator.nextInt(8) + 1;
					randomNumber2 = randomNumberGenerator.nextInt(10) + 1;
					randomNumber3 = randomNumberGenerator.nextInt(10) + 1;
					randomNumber4 = randomNumberGenerator.nextInt(5)+1;
					
					heroDMG = randomNumber;
					heroHEAL = randomNumber2;
					bossDMG = randomNumber3;
					citizenDMG = randomNumber4;
					
					JOptionPane.showMessageDialog(null, "You have hit the citizen dealing " + heroDMG + " damage!");
					JOptionPane.showMessageDialog(null, "The citizen punched you dealing " + citizenDMG + " damage!");
					JOptionPane.showMessageDialog(null, "Your health dropped to " + (heroHP - citizenDMG) + "!\n The citizen's health dropped to " + (citizenHP - heroDMG) + "!");					
					break;
				case "H":
				case "h":	
					
			}
		}
		
	}
}
